<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('初始多表格')" />
    <th:block th:include="include :: datetimepicker-css" />
    <style>
        .headerBox {
            margin-right: -15px;
            margin-left: -15px;
        }
        .input-time {
            width: 200px !important;
        }
        .labelBox {
            display: flex;
            align-items: center;
        }
        .labelBox select{
            height: 40px !important;
        }
    </style>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="headerBox">
        <div class="col-sm-12 search-collapse">
            <p class="select-title">获取业务量收费上报表</p>
            <form id="traffic-form">
                <div class="select-list">
                    <ul>
                        <li class="labelBox">
                            <label class="is-required">公司：</label>
                            <select name="companyId" required class="form-control" th:with="type=${@dict.getType('company')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictCode}" ></option>
                            </select>
                        </li>
                        <li class="select-time">
                            <label>开始截至时间： </label>
                            <input type="text" class="input-time" id="createTimeStart3" name="createTimeStart" placeholder="开始时间" required>
                            <span>-</span>
                            <input type="text" class="input-time" id="createTimeEnd3" name="createTimeEnd"  placeholder="结束时间" required>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="exportTraffic()" shiro:hasPermission="system:order:getTrafficChargeReport"><i class="fa fa-search"></i>&nbsp;导出</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('traffic-form')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
    </div>
    <div class="headerBox">
        <div class="col-sm-12 search-collapse">
            <p class="select-title">获取用药量上报表</p>
            <form id="dose-form">
                <div class="select-list">
                    <ul>
                        <li class="labelBox">
                            <label class="is-required">公司：</label>
                            <select name="companyId" required class="form-control" th:with="type=${@dict.getType('company')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictCode}" ></option>
                            </select>
                        </li>
                        <li class="select-time">
                            <label>开始截至时间： </label>
                            <input type="text" class="input-time" id="createTimeStart2" name="createTimeStart" placeholder="开始时间" required>
                            <span>-</span>
                            <input type="text" class="input-time" id="createTimeEnd2" name="createTimeEnd"  placeholder="结束时间" required>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="exportDose()" shiro:hasPermission="system:order:getDoseReport"><i class="fa fa-search"></i>&nbsp;导出</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('dose-form')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
    </div>
    <div class="headerBox">
        <div class="col-sm-12 search-collapse">
            <p class="select-title">获取业务量上报表</p>
            <form id="business-form">
                <div class="select-list">
                    <ul>
                        <li class="labelBox">
                            <label class="is-required">公司：</label>
                            <select name="companyId" required class="form-control" th:with="type=${@dict.getType('company')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictCode}" ></option>
                            </select>
                        </li>
                        <li class="select-time">
                            <label>开始截至时间： </label>
                            <input type="text" class="input-time" id="createTimeStart1" name="createTimeStart" placeholder="开始时间" required>
                            <span>-</span>
                            <input type="text" class="input-time" id="createTimeEnd1" name="createTimeEnd"  placeholder="结束时间" required>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="exportBusiness()" shiro:hasPermission="system:order:getBusinessVolumeReport"><i class="fa fa-search"></i>&nbsp;导出</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('business-form')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
    </div>
    <div class="headerBox">
        <div class="col-sm-12 search-collapse">
            <p class="select-title">根据条件导出业务报表</p>
            <form id="time-form">
                <div class="select-list">
                    <ul>
                        <li class="labelBox">
                            <label>公司：</label>
                            <select id="companyId" name="companyId" required class="form-control" th:with="type=${@dict.getType('company')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictCode}" ></option>
                            </select>
                        </li>
                        <li class="labelBox">
                            <label>药剂的类别：</label>
                            <select id="medicineCategory" name="medicineCategory" required class="form-control" th:with="type=${@dict.getType('business_type')}">
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}" ></option>
                            </select>
                        </li>
                        <li class="select-time">
                            <label>开始截至时间： </label>
                            <input type="text" class="input-time" name="createTimeStart" id="createTimeStart" placeholder="开始时间" required>
                            <span>-</span>
                            <input type="text" class="input-time" name="createTimeEnd" id="createTimeEnd" placeholder="结束时间" required>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="exportOrder()" shiro:hasPermission="system:order:getDisinfectionStatisticsReport"><i class="fa fa-search"></i>&nbsp;导出</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('time-form')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
    </div>
</div>

<div th:include="include :: footer"></div>
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
    var prefix = ctx + "demo/operate";

    $(function() {

        $("#createTimeStart").datetimepicker({
            format: "yyyy-mm-dd hh:ii:ss",
            autoclose: true
        });
        $("#createTimeEnd").datetimepicker({
            format: "yyyy-mm-dd hh:ii:ss",
            autoclose: true
        });
        $("#createTimeStart1").datetimepicker({
            format: "yyyy-mm-dd hh:ii:ss",
            autoclose: true
        });
        $("#createTimeEnd1").datetimepicker({
            format: "yyyy-mm-dd hh:ii:ss",
            autoclose: true
        });
        $("#createTimeStart2").datetimepicker({
            format: "yyyy-mm-dd hh:ii:ss",
            autoclose: true
        });
        $("#createTimeEnd2").datetimepicker({
            format: "yyyy-mm-dd hh:ii:ss",
            autoclose: true
        });
        $("#createTimeStart3").datetimepicker({
            format: "yyyy-mm-dd hh:ii:ss",
            autoclose: true
        });
        $("#createTimeEnd3").datetimepicker({
            format: "yyyy-mm-dd hh:ii:ss",
            autoclose: true
        });
    });


    function exportOrder() {
        if ($.validate.form('time-form')) {
            var data = $("#time-form").serializeArray();
            let query = '';
            data.forEach((item, index) => {
                query += (item.name + "=" + item.value);
                if (data.length != index + 1) {
                    query += "&"
                }
            });
            window.open('/order/getDisinfectionStatisticsReport?' + query);
        }
    }

    function exportBusiness() {
        if ($.validate.form('business-form')) {
            var data = $("#business-form").serializeArray();
            let query = '';
            data.forEach((item, index) => {
                query += (item.name + "=" + item.value);
                if (data.length != index + 1) {
                    query += "&"
                }
            });
            window.open('/order/getBusinessVolumeReport?' + query);
        }
    }

    function exportDose() {
        if ($.validate.form('dose-form')) {
            var data = $("#dose-form").serializeArray();
            let query = '';
            data.forEach((item, index) => {
                query += (item.name + "=" + item.value);
                if (data.length != index + 1) {
                    query += "&"
                }
            });
            window.open('/order/getDoseReport?' + query);
        }
    }

    function exportTraffic() {
        if ($.validate.form('traffic-form')) {
            var data = $("#traffic-form").serializeArray();
            let query = '';
            data.forEach((item, index) => {
                query += (item.name + "=" + item.value);
                if (data.length != index + 1) {
                    query += "&"
                }
            });
            window.open('/order/getTrafficChargeReport?' + query);
        }
    }
</script>
</body>
</html>